# Importing Data
VIETNAM <- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "AO1:AO239")

# Checking the Imported Data
View(VIETNAM)
# Creating Time Series Data
VIETNAM_ts <- ts(VIETNAM, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
VIETNAM_ts
sum(is.na(VIETNAM_ts))
library(forecast)
VIETNAM_ts <- tsclean(VIETNAM_ts)
VIETNAM_ts

# Identification: Plotting the Time Series Data
plot(VIETNAM_ts)

# Estimating the appropriate model
VIETNAM_ts_model <- auto.arima(VIETNAM_ts)
VIETNAM_ts_model

# Forecasting
options(max.print=1000000)
VIETNAM_ts_forecast <- forecast (VIETNAM_ts_model, level=c(95), h=255)
plot(VIETNAM_ts_forecast)
VIETNAM_ts_forecast             

# Exporting
write.table(VIETNAM_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/VIETNAM_TSA.csv", sep=",")
